<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.js"></script>
</head>
<body>
<div id="app">

    <conmponent :is="currentCom"></conmponent>

</div>
<template id="tLogin">
    <div>
            <span>用户名：</span>
            <input type="text">
            <span>密码：</span>
            <input type="password">
            <input type="button" value="Login" @click="show()">
    </div>
</template>
<script>
    new Vue({
        el: '#app',
        data: {
            currentCom: 'login'
        },

        components: {
            login: {
                template: '#tLogin',
                data () {
                    return {
                        msg: '登录成功'
                    }
                },
                methods: {
                    show () {
                        alert(this.msg)
                    }
                }

            }
        }
    })
</script>
</body>
</html>
